/**
 * @file Define all Weibo relevant handlers 
 * 
 * @author Steve Gao<gaofu@parllay.com>
 */

const WebBaseController = require('./web-base-controller');
const SystemServices    = require('../../constants').SystemServices;

/**
 * The WeiboController
 * 
 * @class WeiboController
 * @extends {BaseController}
 */

class WeiboController extends WebBaseController {

    get name() {
        return 'WeiboController';
    }

    get handlersPath() {
        return 'weibo';
    }

    get weiboService() {
        return this.getSystemService(SystemServices.WEIBO_SERVICE);
    }

    getWeiboRedirectURL(request, parentCallback) {
        this.weiboService.getWeiboRedirectURL(request, (url) => {
            parentCallback(url);
        });
    }

    handleWeiboAuthorization(params, userId, parentCallback) {
        this.weiboService.handleWeiboAuthorization(params, userId, (result) => {
            parentCallback(result);
        });
    }
}

exports.WeiboController = WeiboController;